#pragma once
#include "ISomeContainterIterator.h"
#include <boost/atomic.hpp>
class IObject;

class CSomeContainer
{
    struct Node
    {
        boost::shared_ptr<IObject> data;
        int index;
        boost::shared_ptr<Node> next;
        Node(boost::shared_ptr<IObject> d, int ind, boost::shared_ptr<Node> n)
            : data(d)
            , index(ind)
            , next(n)
        {}
    };
public:
    CSomeContainer();
    ~CSomeContainer();

    bool Register(int objectId, boost::shared_ptr<IObject> object);
    bool Unregister(int objectId);
    boost::shared_ptr<IObject> Query(int objectId);

    std::auto_ptr<ISomeContainterIterator> CreateIterator();

private:
    friend class CSomeContainterIterator;
    boost::atomic<Node*> m_head;
};
